<?php 

namespace App\Models\Admin;

use Zizaco\Entrust\EntrustRole;

class Role extends EntrustRole{
	
	protected $guarded = [];
	
	public function givePermissionsTo(array $PermissionsId){
        $this->detachPermissions($this->perms);
        $this->attachPermissionToId($PermissionsId);
    }

    public function attachPermissionToId($PermissionsId)
    {
        foreach ($PermissionsId as $pid) {
            $this->attachPermission($pid);
        }
    }
}